<script type="text/javascript">
function chuyuansearch(){
	$("#chuyuans").modal('open');
}

function chuyuancheck(){
	var pid = $("#pidcheck").val();
	$.post('${ctx}/main/chuyuancheck',{"pid":pid},function(data){
		if(data.info!=null){
	    $("#chuyuan_all").html("");
		$("#chuyuan_all").append("<tr>"
                            +"<td>"+data.info.M_ID+"</td>"
                            +"<td>"+data.info.P_NAME+"</td>"
                            +"<td>"+data.info.SEX+"</td>"
                            +"<td>"+data.info.DIAGNOSIS+"</td>"
                            +"<td>"+data.info.W_ID+"</td>"
                            +"<td>"+data.info.BED_ID+"</td>"
                            +"<td>"+data.info.IN_TIME+"</td>"
                            +"<td><button onclick='chuyuansure("+data.info.P_ID+")'>出院</button></td>"
                       +" </tr>");
		$("#chuyuans").modal('close');
		$("#chuyuaninfo").modal('open');
		}else{
			$("#myalertbody").html("没有信息！");
			$("#my-alert").modal('open');
		}
	},'json');
}

function chuyuansure(pid){
	$.post('${ctx}/main/chuyuansure',{"pid":pid},function(data){
		if(data.data.success){
			$("#chuyuaninfo").modal('close');
			$("#myalertbody").html("成功出院！");
			$("#my-alert").modal('open');
			$("#chuyuan_all").html("");
			$("#pidcheck").val("");
		}else{
			$("#myalertbody").html(data.data.fail);
			$("#my-alert").modal('open');
		}
	},'json');
}
</script>

<div class="am-modal am-modal-no-btn" tabindex="-1" id="chuyuans">
		<div class="am-modal-dialog"
			style="width: 240px; border-radius: 10px;">
			<div class="am-modal-hd">
				<h3>请输入病人序列号</h3>
				<a href="javascript: void(0)" class="am-close am-close-spin"
					data-am-modal-close>&times;</a>
			</div>
			<div class="am-form am-form-horizontal">
				<div class="am-form-group">
					<div class="am-u-sm-20">
						<input id="pidcheck" style="width: 200px;" type="text"
							class="am-form-field am-round" placeholder="病人序列号"
							required="required" />
					</div>
				</div>
				<div class="am-form-group">
					<div class="am-u-sm-15 am-u-sm-offset-2">
						<button class="am-btn am-btn-default" onclick="chuyuancheck()">确定</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="chuyuaninfo">
		<div class="am-modal-dialog"
			style="width: 1000px; border-radius: 10px;">
			<div class="am-modal-hd">
				<h3>病人信息</h3>
				<a href="javascript: void(0)" class="am-close am-close-spin"
					data-am-modal-close>&times;</a>
			</div>
			<div id="dept1" class="am-modal-bd">
				<table
					class="am-table am-table-bordered am-table-radius am-table-striped">
					<thead>
						<tr>
							<th style="text-align: center">病历号</th>
							<th style="text-align: center">姓名</th>
							<th style="text-align: center">性别</th>
							<th style="text-align: center">症状</th>
							<th style="text-align: center">病房号</th>
							<th style="text-align: center">病床号</th>
							<th style="text-align: center">入院时间</th>
							<th style="text-align: center">操作</th>
						</tr>
					</thead>
					<tbody id="chuyuan_all">
                        
					</tbody>
				</table>
			</div>
		</div>
	</div>